//
//  kata_MapStopViewController.m
//  CityStar
//
//  Created by wangjia on 14-7-16.
//  Copyright (c) 2014年 kata. All rights reserved.
//

#import "kata_MapStopViewController.h"

@interface kata_MapStopViewController ()

@end

@implementation kata_MapStopViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"地图";
//    [self.btnCancel setGrayStyle];
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 90, 30)];
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [leftButton setFrame:CGRectMake(-30, 0, 90, 30)];
    [leftButton setTitle:@"返回" forState:UIControlStateNormal];
    leftButton.titleLabel.font = [UIFont systemFontOfSize:15];
    [leftButton setTitleColor:[UIColor colorWithWhite:0.200 alpha:1.000] forState:UIControlStateNormal];
    [leftButton setTitleColor:[UIColor colorWithRed:0.991 green:0.532 blue:0.303 alpha:1.000] forState:UIControlStateHighlighted];
    [leftButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    [leftButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [leftButton setImage:[UIImage imageNamed:@"back_touch"] forState:UIControlStateHighlighted];
    
    [view addSubview:leftButton];
    
    UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:view];
    self.navigationItem.leftBarButtonItem = barButtonItem;
//    [self.vContent setShowsUserLocation:YES];
//    [self.vContent setZoomLevel:15];
//    [self.vContent setZoomEnabled:YES];
//    [self.vContent setScrollEnabled:YES];
    
    
    
    
//    BMKPointAnnotation * annotation = [[BMKPointAnnotation alloc] init];
//    annotation.title = self.annoTitle;
//    
//    CLLocationCoordinate2D coor;
//    
//    coor.latitude = [self.lat floatValue];
//    coor.longitude = [self.lng floatValue];
//
//    [mapView setCenterCoordinate:coor];
//    annotation.coordinate = coor;
//    [mapView addAnnotation:annotation];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)connectAction:(id)sender {
    UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"是否联系管理员" message:@"182-2906-2533" delegate:self cancelButtonTitle:nil otherButtonTitles:@"拨号",@"取消", nil];
    av.tag = 1;
    [av show];
}

- (IBAction)cancelAction:(id)sender {
    UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"是否取消订单" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确认",@"取消", nil];
    av.tag = 2;
    [av show];
}

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
    if (alertView.tag == 1) {
        if (buttonIndex == 0) {
            NSString *phone = @"182-2906-2533";
            NSString *telUrl = [NSString stringWithFormat:@"telprompt:%@",phone];
            NSURL *url = [[NSURL alloc] initWithString:telUrl];
            [[UIApplication sharedApplication] openURL:url];
        }
    }else if(alertView.tag == 2){
        if (buttonIndex == 0) {
            
        }
    }
    
}
@end
